<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <title>项目管理</title>
    <%@ include file="/WEB-INF/views/modules/commons/head.jsp" %>
    <%--多选css--%>
    <link rel="stylesheet" href="<s:url value="/assets/web/js/multiSelect/css/fselect.css"></s:url>">
    <!-- header -->
    <%@ include file="/WEB-INF/views/include/header.jsp" %>
    <style>
        /*转成省略号*/
        .ui-jqgrid tr.jqgrow td {
            white-space: normal !important;
            height: 35px;
            vertical-align: text-top;
            padding-top: 2px;
        }

        .nav {
            margin-left: 0;
        }

        #gview_gridTable .ui-jqgrid-bdiv {
            max-height: 450px;
            !important;
        }

        .nav > li > a:focus, .nav > li > a:hover {
            text-decoration: none;
            background-color: #33CCFF !important;
        }

        #main-container {
            padding-top: 15px;
            position: relative;
            height: calc(100%);
            margin-left: 17.5%;
            margin-top: 60px;
        }

        .modal-dialog {
            z-index: 9999999;
        }

        @media (min-width: 768px) {
            .modal-content {
                -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, .5);
                box-shadow: 0 -2px 20px rgba(0, 0, 0, .5) !important;
            }
        }

        td {
            cursor: default;
        }

        /*个数*/
        #banjieNum {
            background-color: #d15b47 !important;
            margin: 10px 3px;
            color: #fff;
            position: absolute;
            top: -15px;
            right: -17px;
        }

        .project_detail_css {
            font-size: 18px;
        }

        .project_detail_css em {
            font-size: 20px;
            color: #ff2626;
            cursor: pointer;
        }

        .pdd {
            margin: 5px 0px;
        }

        .ppdd {
            margin: 0px;
        }
    </style>
</head>
<body class="bgcolor">
<%--上传成功模态框--%>
<div class="shade" style="display: none;"></div>
<div class="warning" style="display: none;">
    <p class="title"><em></em><span class="close">X</span></p>
    <p class="cont"></p>
    <div class="la-square-jelly-box la-3x">
        <div></div>
        <div></div>
    </div>
</div>
<%@ include file="/WEB-INF/views/modules/commons/nav.jsp" %>
<%@ include file="/WEB-INF/views/modules/commons/menu.jsp" %>
<!-- /section:basics/navbar.layout -->
<table></table>
<div class="main-container" id="main-container">
    <!-- /section:basics/sidebar -->
    <div class="main-content">
        <div class="main-content-inner">
            <div class="page-content">
                <!-- /section:settings.box -->
                <div class="row" style="position: static">
                    <div class="" style="margin-bottom: 6px !important;">
                        <div class="no-padding-left form-group">
                            <div class="col-sm-3 form-group">
                                <div class="col-sm-8" style="padding-left: 0;">
                                    <input class="form-control" type="text" id="searchWord"
                                           placeholder="请输入要搜索的关键词"/>
                                </div>
                                <div class="col-sm-4" style="right: 20px;">
                                    <button class="btn btn-large btn-primary" id="query">搜索</button>
                                </div>
                            </div>
                            <div class="col-sm-9 form-group" style="right: 55px;">
                                <div class="col-sm-2" style="">
                                    <select id="status_select" class="form-control">
                                        <option value="">选择项目状态</option>
                                        <option value="">全部项目</option>
                                        <option value="1">审批部门未确认</option>
                                        <option value="2">未审核</option>
                                        <option value="5">审核未通过</option>
                                        <option value="3">节点进行中</option>
                                        <option value="6">已暂停</option>
                                        <option value="4">已开工</option>
                                    </select>
                                </div>
                                <div class="col-sm-2" style="">
                                    <select id="industryType_select" class="form-control">
                                        <option value="">选择行业分类</option>
                                        <option value="">全部项目</option>
                                        <option value="1001">旅游特色小镇项目</option>
                                        <option value="1002">工业项目</option>
                                        <option value="1003">交通</option>
                                        <option value="1004">城镇基础设施</option>
                                        <option value="1005">安置房项目</option>
                                        <option value="1006">社会事业项目</option>
                                        <option value="1007">商住项目</option>
                                        <option value="1008">农林水利环保生态项目</option>
                                    </select>
                                </div>
                                <div class="col-sm-2" style="">
                                    <select id="projectType_select" class="form-control">
                                        <option value="">选择项目分类</option>
                                        <option value="">全部项目</option>
                                        <option value="2001">计划新开工项目</option>
                                        <option value="2002">结转项目</option>
                                    </select>
                                </div>
                                <div class="col-sm-2" style="">
                                    <select id="year_select" class="form-control">
                                        <option value="">选择入库时间</option>
                                        <option value="">全部项目</option>
                                        <option value="2018">2018年</option>
                                        <option value="2019">2019年</option>
                                        <option value="2020">2020年</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <!-- jqGrid表格 -->
                        <table id="gridTable"></table>
                        <!-- jqGrid工具类 -->
                        <div id="gridPager"></div>
                        <!-- 查询对话框 -->
                        <div style="display: none;">
                            <div class="row" id="queryDialog"></div>
                        </div>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
                <div class="row" style="margin-left: 2px;">
                    <h3>项目总体情况：</h3>
                </div>
                <%--文字描述--%>
                <div class="project_detail_css">
                    <div class="pdd"><p class="ppdd">系统中有<em id="allP1"></em>个项目，其中已完成项目<em
                            id="yikaigong1"></em>个，未开工项目<em id="weikaigong1"></em>个，累计投资 <span
                            id="plannedInvestment1" style="border-bottom: 1px solid;"></span>万元。</p></div>
                    <div class="pdd"><p class="ppdd">计划新开工项目有<em id="allP2"></em>个项目，其中已完成项目<em
                            id="yikaigong2"></em>个，未开工项目<em id="weikaigong2"></em>个，累计投资 <span
                            id="plannedInvestment2" style="border-bottom: 1px solid;"></span>万元。</p></div>
                    <div class="pdd"><p class="ppdd">结转项目有<em id="allP3"></em>个项目，其中已完成项目<em
                            id="yikaigong3"></em>个，未开工项目<em id="weikaigong3"></em>个，累计投资 <span
                            id="plannedInvestment3" style="border-bottom: 1px solid;"></span>万元。</p></div>
                </div>
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
        <i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
    </a>

</div><!-- /.main-container -->
</div>
<!-- footer -->
<script src="<s:url value="/assets/web/js/jquery.min.js?v=2.1.4"></s:url>"></script>
<%--公用js--%>
<script src="<s:url value="/assets/web/js/commo.js"></s:url>"></script>
<link rel="stylesheet" href="<s:url value="/assets/web/css/login/bootstrap.min.css?v=3.3.6"></s:url>">
<script src="<s:url value="/assets/web/js/jqpaginator.min.js"></s:url>"></script>
<script src="<s:url value="/assets/web/js/baseAPI.js"></s:url>"></script>
<%--多选js--%>
<script src="<s:url value="/assets/web/js/multiSelect/js/fselect.js"></s:url>"></script>
<script src="<s:url value="/assets/web/common/bootstrapvalidator/dist/js/bootstrapValidator.js"></s:url>"></script>
<%@ include file="/WEB-INF/views/include/footer.jsp" %>
<!-- dialog -->
<%@ include file="/WEB-INF/views/include/dialog.jsp" %>


<script type="text/javascript">
    //基本路径
    var baseUrl = "<s:url value="/projectManageSuper/myCollection"></s:url>/";
    var baseUrl_old = "<s:url value="/projectManageSuper"></s:url>/";
    //jqgrid的表格高度
    var height = 320;
    //jqgrid表格行头的中文
    var colNames = [
        '', '项目名称', '责任单位', '分管领导', '联系人', '联系人手机号', '项目状态', '行业分类', '项目分类', '进入督查的节点', '收藏操作'
    ];

    var colModel = [
        {name: 'sysId', index: 'sysId', hidden: true, editable: true, key: true},
        {name: 'name', index: 'name', width: 270, editable: true},
        {name: 'resDept', index: 'resDept', width: 185, editable: true},
        {name: 'resUser', index: 'resUser', width: 90, editable: true},
        {name: 'contactName', index: 'contactName', width: 90, editable: true},
        {name: 'contactPhone', index: 'contactPhone', width: 110, editable: true},
        {name: 'status', index: 'status', width: 100, editable: true, formatter: statusFmatter},
        {name: 'industryType', index: 'industryType', width: 120, editable: true, formatter: industryTypeFmatter},
        {name: 'projectType', index: 'projectType', width: 120, editable: true, formatter: projectTypeFmatter},
        {name: 'supervisionNodes', index: 'supervisionNodes', width: 270, editable: true},
        {name: 'collectFlag', index: 'collectFlag', width: 100, editable: true, formatter: showbtnFmatter}
    ];

    //jqgrid的具体执行方法
    jqgrid({
        autoScroll: false,
        shrinkToFit: true,
        gridTableId: "#gridTable",
        gridPagerId: "#gridPager",
        onSelectRow: function (rowid, status) {
            if (!status) {
                gridRemoveSelect(rowid);
            } else {
                var flag = false;
                for (var i = 0; i < rowids.length; i++) {
                    if (rowids[i] == rowid) {
                        flag = true;
                        continue;
                    }
                }
                if (!flag) {
                    gridAddSelect(rowid);
                }
            }
        },
        gridComplete: function () {
            var rowIds = jQuery("#gridTable").jqGrid('getDataIDs');
            for (var k = 0; k < rowIds.length; k++) {
                var flag = false;
                for (var i = 0; i < rowids.length; i++) {
                    if (rowids[i] == rowIds[k]) {
                        flag = true;
                        continue;
                    }
                }
                if (flag && flag == true) {
                    jQuery("#gridTable").setSelection(rowIds[k], true);
                }
            }
        }
    });
    //清空选中行
    $("#cancelChecked").click(function () {
        $("#gridTable").jqGrid('resetSelection');
        rowids = [];
    });
    var rowids = [];//选中行id
    /**
     * 取消选中
     */
    function gridRemoveSelect(rowid) {
        rowids.remove(rowid);
    }

    /**
     * 添加选中
     */
    function gridAddSelect(rowid) {
        rowids.push(rowid);
    }

    /**
     * 重写Array
     */
    Array.prototype.remove = function (val) {
        var index = this.indexOf(val);
        if (index > -1) {
            this.splice(index, 1);
        }
    };
    /**
     * 重写Array
     */
    Array.prototype.indexOf = function (val) {
        for (var i = 0; i < this.length; i++) {
            if (this[i] == val) return i;
        }
        return -1;
    };
    //开启冻结列
    $("#gridTable").jqGrid('setFrozenColumns');
    // //加载查询对话框
    // $("#queryDialog").load(getUrl("filter"));

    //重置表单
    function reset() {
        resetForm("#formDialog form");
    }

    var exportData = '';
    //显示查询对话框
    var queryDialog = $("#queryDialog");
    $("#taskToTack").click(function () {
        window.location.href = '/taskToTack';
    });

    function colorSet() {
        return "style='color:#ff0000'";
    }

    function overdueDaysFmatter(cellvalue) {
        if (cellvalue != null) {
            return cellvalue + "天";
        } else {
            return "——";
        }
    }

    $(function () {
        //不同用户显示不通按钮
        var userType = ${user.branchType};
        var userRole = "${user.role}";
        if (userRole == "责任人") {
        } else {
            if (userType == "4") {
            }
            if (userType == "1") {
            }
            if (userType == "0") {
            }
            //管理员菜单
            if (userType == "2") {
                $(".project_detail_css").css("display", "inline");
            }
        }
    })

    $("#exportTackTable").click(function () {
        alert("暂无攻坚任务");
    });

    //最新搜索
    $("#query").click(function () {
        var url = '/projectManageSuper/myCollection';
        var searchWord = $("#searchWord").val();
        //先清空条件,多次调用时查询条件会累加
        $('#gridTable').jqGrid('clearGridData');
        $("#gridTable").jqGrid('setGridParam', {
            url: url,
            datatype: 'json',
            postData: {'searchWord': searchWord}, //发送数据
            page: 1
        }).trigger("reloadGrid"); //重新载入
    });
    // //搜索右边条件搜索
    // $("#schedCode_select").change(function () {
    //     var url = '/projectManageSuper';
    //     var searchWord = $("#schedCode_select").val();
    //     //先清空条件,多次调用时查询条件会累加
    //     $('#gridTable').jqGrid('clearGridData');
    //     $("#gridTable").jqGrid('setGridParam', {
    //         url: url,
    //         datatype: 'json',
    //         postData: {'schedCode': searchWord, 'status': "", 'industryType': "", 'projectType': ""}, //发送数据
    //         page: 1
    //     }).trigger("reloadGrid"); //重新载入
    // });
    $("#status_select").change(function () {
        var url = '/projectManageSuper/myCollection';
        var flag = $("#status_select").val();
        //先清空条件,多次调用时查询条件会累加
        $('#gridTable').jqGrid('clearGridData');
        $("#gridTable").jqGrid('setGridParam', {
            url: url,
            datatype: 'json',
            postData: {'flag': flag}, //发送数据
            page: 1
        }).trigger("reloadGrid"); //重新载入
    });
    $("#industryType_select").change(function () {
        var url = '/projectManageSuper/myCollection';
        var searchWord = $("#industryType_select").val();
        //先清空条件,多次调用时查询条件会累加
        $('#gridTable').jqGrid('clearGridData');
        $("#gridTable").jqGrid('setGridParam', {
            url: url,
            datatype: 'json',
            postData: {'industryType': searchWord}, //发送数据
            page: 1
        }).trigger("reloadGrid"); //重新载入
    });
    $("#projectType_select").change(function () {
        var url = '/projectManageSuper/myCollection';
        var searchWord = $("#projectType_select").val();
        //先清空条件,多次调用时查询条件会累加
        $('#gridTable').jqGrid('clearGridData');
        $("#gridTable").jqGrid('setGridParam', {
            url: url,
            datatype: 'json',
            postData: {'projectType': searchWord}, //发送数据
            page: 1
        }).trigger("reloadGrid"); //重新载入
    });

    /**
     * --------------完成情况记录提交事件 recordEdit ----------
     */
    function recordEdit() {
        console.log("催办记录")
        executeSaveOrUpdate({
            formId: "#formDialog form",
            dialogId: "#formDialog",
            url: getUrl("createRespRecord"),
            tableId: "#gridTable",
            successMessage: "操作成功",
            successTitle: '操作对话框',
            //failMessage: '更新失败',
            failTitle: '消息对话框'
        });
        //倒计时
        var btn = document.getElementById("submit");
        btn.disabled = true;
        countdown(5);
    }

    /**
     * 双击显示
     */
    $("#gridTable").dblclick(function (e) {
        showDetailView();
    });

    //显示编辑对话框(双击显示)
    function showDetailView() {
        var rowId = $('#gridTable').jqGrid('getGridParam', "selrow");
        // var rowData = $("#gridTable").jqGrid('getRowData', rowId);
        loadDialog({
            dialogTitle: '项目基本情况',
            dialogUrl: baseUrl_old + "/detail/" + rowId,
            dialogFoot: '<button type="button" class="btn btn-default" data-dismiss="modal" id="showDetail" >关闭</button>'
        });
    }

    function statusFmatter(cellvalue, options, rowObject) {
        if (cellvalue == "2") {
            return "未审核";
        } else if (cellvalue == "3") {
            return "节点进行中";
        } else if (cellvalue == "4") {
            return "已开工";
        } else if (cellvalue == "5") {
            return "审核未通过";
        } else if (cellvalue == "6") {
            return "已暂停";
        } else {
            return "审批部门未确认";
        }
    }

    function industryTypeFmatter(cellvalue, options, rowObject) {
        if (cellvalue == "1001") {
            return "旅游特色小镇项目";
        } else if (cellvalue == "1002") {
            return "工业项目";
        } else if (cellvalue == "1003") {
            return "交通";
        } else if (cellvalue == "1004") {
            return "城镇基础设施";
        } else if (cellvalue == "1005") {
            return "安置房项目";
        } else if (cellvalue == "1006") {
            return "社会事业项目";
        } else if (cellvalue == "1007") {
            return "商住项目";
        } else if (cellvalue == "1008") {
            return "农林水利环保生态项目";
        }
    }

    //添加收藏按钮
    function showbtnFmatter(cellvalue, options, rowObject) {
        var val = options.rowId;
        if (cellvalue == null || cellvalue == "") {
            var imgeHtml = " <button class=\"col-sm-5 btn btn-large btn-primary\" style='width: 80px;border:0 !important;padding: 5px 8px !important;'  onclick=\"collectProject('" + val + "'); \">点击收藏</button> ";
            return imgeHtml;
        } else {
            var imgeHtml = " <button class=\"col-sm-5 btn btn-large btn-primary\" style='width: 80px;border:0 !important;padding: 5px 8px !important;'  onclick=\"cancelCollectProject('" + val + "'); \">取消收藏</button> ";
            return imgeHtml;
        }
    }

    function projectTypeFmatter(cellvalue, options, rowObject) {
        if (cellvalue == "2001") {
            return "计划新开工项目";
        } else if (cellvalue == "2002") {
            return "结转项目";
        }
    }

    //显示隐藏
    $(function () {
        //显示隐藏
        $(".clickMe").click(function () {
            if ($(this).text() === "更多∨") {
                $("#more_show").show(100);
                $(this).text("收起∧")
            } else if ($(this).text() === "收起∧") {
                $("#more_show").hide(100);
                $(this).text("更多∨");
            }
        });
    })

    function addCellAttr(rowId, val, rawObject, cm, rdata) {
        if (rawObject.aaa001 == "0") {
            return "style='color:red'";
        }
    }

    //修改——返回
    function editPro_back() {
        var rowId = $('#gridTable').jqGrid('getGridParam', "selrow");
        // var rowData = $("#gridTable").jqGrid('getRowData', rowId);
        loadDialog({
            dialogTitle: '项目基本情况',
            dialogUrl: baseUrl + "detail/" + rowId,
            dialogFoot: '<button type="button" class="btn btn-default" data-dismiss="modal" id="showDetail" >关闭</button>'
        });
    }


    $("#year_select").change(function () {
        var url = '/projectManageSuper/myCollection';
        var searchWord = $("#year_select").val();
        //先清空条件,多次调用时查询条件会累加
        $('#gridTable').jqGrid('clearGridData');
        $("#gridTable").jqGrid('setGridParam', {
            url: url,
            datatype: 'json',
            postData: {'createDate': searchWord}, //发送数据
            page: 1
        }).trigger("reloadGrid"); //重新载入
    });
    //全部项目基本情况
    $.ajax({
        type: "GET",
        url: "/app/newProject/openRate",
        dataType: "json",
        success: function (model) {
            var code = model.code;
            if (code == '200') {
                var plannedInvestment1 = model.data.plannedInvestment;
                var yikaigong1 = model.data.startWorkNum;
                var weikaigong1 = model.data.notStartWorkNum;
                var allP1 = parseInt(yikaigong1) + parseInt(weikaigong1);
                $("#yikaigong1").html(yikaigong1);
                $("#weikaigong1").html(weikaigong1);
                $("#allP1").html(allP1);
                var money1 = number_format(plannedInvestment1, 2)
                $("#plannedInvestment1").html(money1);
            }
        },
        error: function (model) {
            console.log("/app/newProject/openRate" + model);
        }
    });

    //计划新开工项目
    $.ajax({
        type: "GET",
        url: "/app/newProject/planeOpenProject",
        dataType: "json",
        success: function (model) {
            var code = model.code;
            if (code == '200') {
                var plannedInvestment2 = model.data.plannedInvestment;
                var yikaigong2 = model.data.startWorkNum;
                var weikaigong2 = model.data.notStartWorkNum;
                var allP2 = parseInt(yikaigong2) + parseInt(weikaigong2);
                $("#yikaigong2").html(yikaigong2);
                $("#weikaigong2").html(weikaigong2);
                $("#allP2").html(allP2);
                var money2 = number_format(plannedInvestment2, 2)
                $("#plannedInvestment2").html(money2);
            }
        },
        error: function (model) {
            console.log("/app/newProject/planeOpenProject" + model);
        }
    });

    /*结转项目*/
    $.ajax({
        type: "GET",
        url: "/app/newProject/jzProject",
        dataType: "json",
        success: function (model) {
            var code = model.code;
            if (code == '200') {
                var plannedInvestment3 = model.data.plannedInvestment;
                var yikaigong3 = model.data.startWorkNum;
                var weikaigong3 = model.data.notStartWorkNum;
                var allP3 = parseInt(yikaigong3) + parseInt(weikaigong3);
                $("#yikaigong3").html(yikaigong3);
                $("#weikaigong3").html(weikaigong3);
                $("#allP3").html(allP3);
                var money3 = number_format(plannedInvestment3, 2)
                $("#plannedInvestment3").html(money3);
            }
        },
        error: function (model) {
            console.log("/app/newProject/jzProject" + model);
        }
    });

    //********************************************全部项目**********************************************
    /*全部项目的点击事件*/
    $("#allP1").click(function () {
        //头部选择框内容重置
        $("#status_select").find("option:contains('选择项目状态')").attr("selected", true);
        $("#industryType_select").find("option:contains('选择行业分类')").attr("selected", true);
        $("#projectType_select").find("option:contains('选择项目分类')").attr("selected", true);
        var url = '/projectManageSuper/myCollection';
        //先清空条件,多次调用时查询条件会累加
        $('#gridTable').jqGrid('clearGridData');
        $("#gridTable").jqGrid('setGridParam', {
            url: url,
            datatype: 'json',
            postData: {'projectType': "", 'status': "", 'schedCode': "", 'industryType': ""}, //发送数据
            page: 1
        }).trigger("reloadGrid"); //重新载入
    });
    /*全部已完成的点击事件*/
    $("#yikaigong1").click(function () {
        //头部选择框内容重置
        $("#status_select").find("option:contains('选择项目状态')").attr("selected", true);
        $("#industryType_select").find("option:contains('选择行业分类')").attr("selected", true);
        $("#projectType_select").find("option:contains('选择项目分类')").attr("selected", true);
        var url = '/projectManageSuper/myCollection';
        //先清空条件,多次调用时查询条件会累加
        $('#gridTable').jqGrid('clearGridData');
        $("#gridTable").jqGrid('setGridParam', {
            url: url,
            datatype: 'json',
            postData: {'projectType': "", 'status': "4", 'schedCode': "", 'industryType': ""}, //发送数据
            page: 1
        }).trigger("reloadGrid"); //重新载入
    });
    /*全部未开工的点击事件*/
    $("#weikaigong1").click(function () {
        //头部选择框内容重置
        $("#status_select").find("option:contains('选择项目状态')").attr("selected", true);
        $("#industryType_select").find("option:contains('选择行业分类')").attr("selected", true);
        $("#projectType_select").find("option:contains('选择项目分类')").attr("selected", true);
        var url = '/projectManageSuper/myCollection';
        //先清空条件,多次调用时查询条件会累加
        $('#gridTable').jqGrid('clearGridData');
        $("#gridTable").jqGrid('setGridParam', {
            url: url,
            datatype: 'json',
            postData: {'projectType': "", 'status': "!4", 'schedCode': "", 'industryType': ""}, //发送数据
            page: 1
        }).trigger("reloadGrid"); //重新载入
    });
    //********************************************计划新开工项目**********************************************
    /*全部项目的点击事件*/
    $("#allP2").click(function () {
        //头部选择框内容重置
        $("#status_select").find("option:contains('选择项目状态')").attr("selected", true);
        $("#industryType_select").find("option:contains('选择行业分类')").attr("selected", true);
        $("#projectType_select").find("option:contains('选择项目分类')").attr("selected", true);
        var url = '/projectManageSuper/myCollection';
        //先清空条件,多次调用时查询条件会累加
        $('#gridTable').jqGrid('clearGridData');
        $("#gridTable").jqGrid('setGridParam', {
            url: url,
            datatype: 'json',
            postData: {'projectType': "2001", 'status': "", 'schedCode': "", 'industryType': ""}, //发送数据
            page: 1
        }).trigger("reloadGrid"); //重新载入
    });
    /*全部已完成的点击事件*/
    $("#yikaigong2").click(function () {
        //头部选择框内容重置
        $("#status_select").find("option:contains('选择项目状态')").attr("selected", true);
        $("#industryType_select").find("option:contains('选择行业分类')").attr("selected", true);
        $("#projectType_select").find("option:contains('选择项目分类')").attr("selected", true);
        var url = '/projectManageSuper/myCollection';
        //先清空条件,多次调用时查询条件会累加
        $('#gridTable').jqGrid('clearGridData');
        $("#gridTable").jqGrid('setGridParam', {
            url: url,
            datatype: 'json',
            postData: {'projectType': "2001", 'status': "4", 'schedCode': "", 'industryType': ""}, //发送数据
            page: 1
        }).trigger("reloadGrid"); //重新载入
    });
    /*全部未开工的点击事件*/
    $("#weikaigong2").click(function () {
        //头部选择框内容重置
        $("#status_select").find("option:contains('选择项目状态')").attr("selected", true);
        $("#industryType_select").find("option:contains('选择行业分类')").attr("selected", true);
        $("#projectType_select").find("option:contains('选择项目分类')").attr("selected", true);
        var url = '/projectManageSuper/myCollection';
        //先清空条件,多次调用时查询条件会累加
        $('#gridTable').jqGrid('clearGridData');
        $("#gridTable").jqGrid('setGridParam', {
            url: url,
            datatype: 'json',
            postData: {'projectType': "2001", 'status': "!4", 'schedCode': "", 'industryType': ""}, //发送数据
            page: 1
        }).trigger("reloadGrid"); //重新载入
    });
    //********************************************结转项目**********************************************
    /*全部项目的点击事件*/
    $("#allP3").click(function () {
        //头部选择框内容重置
        $("#status_select").find("option:contains('选择项目状态')").attr("selected", true);
        $("#industryType_select").find("option:contains('选择行业分类')").attr("selected", true);
        $("#projectType_select").find("option:contains('选择项目分类')").attr("selected", true);
        var url = '/projectManageSuper/myCollection';
        //先清空条件,多次调用时查询条件会累加
        $('#gridTable').jqGrid('clearGridData');
        $("#gridTable").jqGrid('setGridParam', {
            url: url,
            datatype: 'json',
            postData: {'projectType': "2002", 'status': "", 'schedCode': "", 'industryType': ""}, //发送数据
            page: 1
        }).trigger("reloadGrid"); //重新载入
    });
    /*全部已完成的点击事件*/
    $("#yikaigong3").click(function () {
        //头部选择框内容重置
        $("#status_select").find("option:contains('选择项目状态')").attr("selected", true);
        $("#industryType_select").find("option:contains('选择行业分类')").attr("selected", true);
        $("#projectType_select").find("option:contains('选择项目分类')").attr("selected", true);
        var url = '/projectManageSuper/myCollection';
        //先清空条件,多次调用时查询条件会累加
        $('#gridTable').jqGrid('clearGridData');
        $("#gridTable").jqGrid('setGridParam', {
            url: url,
            datatype: 'json',
            postData: {'projectType': "2002", 'status': "4", 'schedCode': "", 'industryType': ""}, //发送数据
            page: 1
        }).trigger("reloadGrid"); //重新载入
    });
    /*全部未开工的点击事件*/
    $("#weikaigong3").click(function () {
        //头部选择框内容重置
        $("#status_select").find("option:contains('选择项目状态')").attr("selected", true);
        $("#industryType_select").find("option:contains('选择行业分类')").attr("selected", true);
        $("#projectType_select").find("option:contains('选择项目分类')").attr("selected", true);
        var url = '/projectManageSuper/myCollection';
        //先清空条件,多次调用时查询条件会累加
        $('#gridTable').jqGrid('clearGridData');
        $("#gridTable").jqGrid('setGridParam', {
            url: url,
            datatype: 'json',
            postData: {'projectType': "2002", 'status': "!4", 'schedCode': "", 'industryType': ""}, //发送数据
            page: 1
        }).trigger("reloadGrid"); //重新载入
    });

    /**
     * 格式化（金额）
     * @param number
     * @param decimals
     * @param dec_point
     * @param thousands_sep
     * @returns {string | *}
     */
    function number_format(number, decimals, dec_point, thousands_sep) {
        number = (number + '').replace(/[^0-9+-Ee.]/g, '');
        var n = !isFinite(+number) ? 0 : +number,
            prec = !isFinite(+decimals) ? 2 : Math.abs(decimals),
            sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
            dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
            s = '',
            toFixedFix = function (n, prec) {
                var k = Math.pow(10, prec);
                return '' + Math.ceil(n * k) / k;
            };
        s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
        var re = /(-?\d+)(\d{3})/;
        while (re.test(s[0])) {
            s[0] = s[0].replace(re, "$1" + sep + "$2");
        }
        if ((s[1] || '').length < prec) {
            s[1] = s[1] || '';
            s[1] += new Array(prec - s[1].length + 1).join('0');
        }
        return s.join(dec);
    }
    //点击收藏
    function collectProject(id) {
        var url = "/web/collection/addCollections/" + id;
        $.ajax({
            type: "GET",
            url: url,
            dataType: "json",
            success: function (model) {
                if (model.code == "200") {
                    alert("添加收藏成功！");
                    window.location.reload();
                } else {
                    alert("添加收藏失败！");
                }
            },
            error: function (model) {
            }
        });
    }

    //取消收藏
    function cancelCollectProject(id) {
        var url = "/web/collection/cancelCollections/" + id;
        $.ajax({
            type: "GET",
            url: url,
            dataType: "json",
            success: function (model) {
                if (model.code == "200") {
                    alert("取消收藏成功！");
                    window.location.reload();
                } else {
                    alert("取消收藏失败！");                }
            },
            error: function (model) {
            }
        });
    }
</script>
</body>
</html>